var app = getApp();
Page({
    data: {
        "search1": {  //搜索
            "type": "search",
            "style": "margin-top:0;height:117.1875rpx;width:100%;background-color:#efeff4;margin-left:auto;",
            "content": {"placeholder": "\u8bf7\u8f93\u5165\u641c\u7d22\u5185\u5bb9"},
            "customFeature": {"hasQuickTags": false, "ifLocation": false, "quickTags": [], "searchObject": ""},
            "animations": [],
            "page_form": "",
            "compId": "search1",
            "parentCompid": "search1"
        },
        "carousel2": { //轮播图
            "type": "carousel",
            "style": "height:398.4375rpx;margin-left:0;margin-right:auto;margin-top:0;opacity:0;",
            "content":[],
            "customFeature": {"autoplay": true, "interval": 2, "carouselgroupId": null},
            "animations": [],
            "page_form": "",
            "compId": "carousel2"
        },
        "album3": { //一级分类
            "style": "background-color:rgb(255, 255, 255);font-size:28.125rpx;opacity:1;text-align:center;margin-left:auto;",
            "ul_style": "padding-top:23.4375rpx;margin-left:auto;",
            "html_mode": "sec-mode",
            "li": [],
            "itemType": "album",
            "itemParentType": null,
            "itemIndex": "album3",
            "content": ""
        },
           //今日热点
        "free_vessel5": { //今日热点
            "type": "free-vessel",
            "style": "width:100%;height:398.4375rpx;background-color:rgb(255, 255, 255);margin-bottom:auto;margin-right:auto;margin-top:18.75rpx;opacity:1;margin-left:auto;",
            "content": [{
                "type": "picture",
                "style": "opacity:1;background-color:transparent;border-color:rgb(34, 34, 34);border-radius:11.71875rpx;border-style:none;height:257.8125rpx;width:100%;margin-left:0;margin-right:0;margin-top:0;position:absolute;left:23.4375rpx;top:35.15625rpx;",
                "content": "http:\/\/img.weiye.me\/zcimgdir\/album\/file_58fda58bd8754.png",
                "customFeature": {
                    "boxShadow": "5",
                    "boxColor": "#000",
                    "boxX": "0",
                    "boxY": "0",
                    "boxR": "5",
                    "action": "inner-link",
                    "inner-page-link": "page10012"
                },
                "animations": [],
                "compId": "data.content[0]",
                "parentCompid": "free_vessel5",
                "itemType": "picture",
                "itemParentType": "free-vessel",
                "itemIndex": 0,
                "eventParams": "{\"inner_page_link\":\"page10012\",\"is_redirect\":0}",
                "eventHandler": "tapInnerLinkHandler"
            }],
            "customFeature": {"boxColor": "rgb(0, 0, 0)", "boxR": 5, "boxStyle": false, "boxX": 0, "boxY": 0},
            "animations": [],
            "page_form": "",
            "compId": "free_vessel5"
        },
        'MeiriGoods':{ //每日逛
            'img':[]
        },
        'Recommended':{  //为您推荐
            "FroYou":[],//图片
            'goods':[],//商品
        },
        "has_tabbar": 1,
        "page_hidden": true,
        "page_form": "",
        "top_nav": {
            "navigationBarBackgroundColor": "#000000",
            "navigationBarTextStyle": "white",
            "navigationBarTitleText": "\u9996\u9875"
        }
    },
    need_login: false,
    page_router: 'page10000',
    page_form: 'none',
    list_compids_params: [],
    user_center_compids_params: [],
    goods_compids_params: [],
    prevPage: 0,
    tostoreComps: [],
    carouselGroupidsParams: [],
    relobj_auto: [],
    bbsCompIds: [],
    dynamicVesselComps: [],
    communityComps: [],
    franchiseeComps: [],
    cityLocationComps: [],
    seckillOnLoadCompidParam: [],
    dynamicClassifyGroupidsParams: [],
    videoListComps: [],
    videoProjectComps: [],
    newsComps: [],
    returnToVersionFlag: true,
    requesting: false,
    requestNum: 1,
    modelChoose: [],
    modelChooseId: 'adas',
    modelChooseName: [],
    Carousel: [], //轮播图
    case_Img: app.globalData.IMG,

    Carouselfigure: function () {  //获取轮播图
        var url = app.globalData.HOST + app.APILIST.getaddata;
        var data = {"data[position]": ""}

        var carouseData = [];
        app.WxRequest(url,data,1,
            (res)=>{
            var res_data = [];
            var xiaoCX = [];

            for (var i=0;i<res.data.length;i++){
                    switch (res.data[i].position) {
                              case '轮播图':
                                  res_data.push(res.data[i]);
                                break;
                              case '小程序为您推荐':
                                  xiaoCX.push(res.data[i]);
                                break;
                            }
        }
            this.setData({
                carousel2:{
                    content:res_data
                },
                Recommended:{
                    FroYou:xiaoCX
                }
             })
           },
        function( ref ) {

        });
    },
    getgoodsclass: function(){  //获取商品分类
        var url = app.globalData.HOST + app.APILIST.getgoodsclass;
        var data = {"data": {"level": ""}}
        app.WxRequest(url,data,1,
            (res)=>{
        this.setData({
            album3:{
                li:res.data
            }
        })
    }, ( ref )=> {

        });
},
    Goods_Class(e){    //点击分类
      app.globalData.classificationId = e.currentTarget.id;

      app.turnToPage("/pages/page10001/page10001");
        // wx.redirectTo({
        //     url: ""  //实际路径要写全
        // })
    },
    /**
     * 跳转到详情页
     */
    turnToDetail: function (e) {
        let id = e.currentTarget.id;
        app.turnToPage('/eCommerce/pages/goodsDetail/goodsDetail?goodsid=' + id);
    },
    CnWhatLike(){  //每日逛
        var url = app.globalData.HOST + app.APILIST.randomgoods;
        var data = {"data":{
          "limit":3
        }}
        app.WxRequest(url,data,1,
            (res)=>{
        this.setData({
            MeiriGoods:{
                img:res.data
            }
        });
    },( ref )=>{

        })
    },

    RecommendedForyou(){ //为您推荐
        var url = app.globalData.HOST + app.APILIST.getGoods;
        var data = {
          "data": {
            "limt": 12
          }}
        app.WxRequest(url,data,1,
            (res)=>{

            this.data.Recommended.goods = res.data;
            console.log(res.data)
            let Recommended = this.data.Recommended;
            this.setData({
              Recommended
            });
        });
    },
    onLoad: function (e) {        //生命周期函数--监听页面加载
        app.onPageLoad(e);
        this.CnWhatLike();  //猜你喜欢
        this.Carouselfigure(); //获取轮播图
        this.getgoodsclass();   //获取商品分类
        this.RecommendedForyou();//为您推荐

    },
    dataInitial: function () {
        app.pageDataInitial();
    },
    onShareAppMessage: function (e) {
        return app.onPageShareAppMessage(e);
    },
    onShow: function () {  //生命周期函数--监听页面显示  每次跳转到此页面 就会调用

    },
    // onHide: function(){    //生命周期函数--监听页面显示  每次离开此页面 会调用
    //     console.log('离开了');
    // },
    // onPullDownRefresh: function(){
    //     console.log('下拉了');
    // },
    reachBottomFuc: [],
    onReachBottom: function () {
        app.onPageReachBottom(this.reachBottomFuc);
    },
    onUnload: function () {
        app.onPageUnload();
        // console.log('卸载');
    },
    tapPrevewPictureHandler: function (e) {
        app.tapPrevewPictureHandler(e);
    },
    suspensionBottom: function () {
        app.suspensionBottom();
    },
    pageScrollFunc: function (e) {
        app.pageScrollFunc(e);
    },
    dynamicVesselScrollFunc: function (e) {
        app.dynamicVesselScrollFunc(e);
    },
    goodsScrollFunc: function (e) {
        app.goodsScrollFunc(e);
    },
    takeoutStyleScrollFunc: function (e) {
        app.takeoutStyleScrollFunc(e);
    },
    franchiseeScrollFunc: function (e) {
        app.franchiseeScrollFunc(e);
    },
    seckillScrollFunc: function (e) {
        app.seckillScrollFunc(e);
    },
    videoScrollFunc: function (e) {
        app.videoScrollFunc(e);
    },
    carouselVideoClose: function (e) {
        app.carouselVideoClose(e);
    },
    changeCount: function (e) {
        app.changeCount(e);
    },
    inputChange: function (e) {
        app.inputChange(e);
    },
    bindDateChange: function (e) {
        app.bindDateChange(e);
    },
    bindTimeChange: function (e) {
        app.bindTimeChange(e);
    },
    bindSelectChange: function (e) {
        app.bindSelectChange(e);
    },
    bindScoreChange: function (e) {
        app.bindScoreChange(e);
    },
    submitForm: function (e) {
        app.submitForm(e);
    },
    udpateVideoSrc: function (e) {
        app.udpateVideoSrc(e);
    },
    tapMapDetail: function (e) {
        app.tapMapDetail(e);
    },
    uploadFormImg: function (e) {
        app.uploadFormImg(e);
    },
    deleteUploadImg: function (e) {
        app.deleteUploadImg(e);
    },
    listVesselTurnToPage: function (e) {
        app.listVesselTurnToPage(e);
    },
    dynamicVesselTurnToPage: function (e) {
        app.dynamicVesselTurnToPage(e);
    },
    userCenterTurnToPage: function (e) {
        app.userCenterTurnToPage(e);
    },
    turnToGoodsDetail: function (e) {
        app.turnToGoodsDetail(e);
    },
    turnToFranchiseeDetail: function (e) {
        app.turnToFranchiseeDetail(e);
    },
    turnToSeckillDetail: function (e) {
        app.turnToSeckillDetail(e);
    },
    sortListFunc: function (e) {
        app.sortListFunc(e);
    },
    bbsInputComment: function (e) {
        app.bbsInputComment(e);
    },
    bbsInputReply: function (e) {
        app.bbsInputReply(e);
    },
    uploadBbsCommentImage: function (e) {
        app.uploadBbsCommentImage(e);
    },
    uploadBbsReplyImage: function (e) {
        app.uploadBbsReplyImage(e);
    },
    deleteCommentImage: function (e) {
        app.deleteCommentImage(e);
    },
    deleteReplyImage: function (e) {
        app.deleteReplyImage(e);
    },
    bbsPublishComment: function (e) {
        app.bbsPublishComment(e);
    },
    clickBbsReplyBtn: function (e) {
        app.clickBbsReplyBtn(e);
    },
    bbsPublishReply: function (e) {
        app.bbsPublishReply(e);
    },
    searchList: function (e) {  //搜索
      app.turnToSearchPage('/pages/page10001/page10001');

        // console.log(this.keywordList[e.target.dataset.compid]);




    },
    selectLocal: function (e) {
        app.selectLocal(e);
    },
    cancelCity: function (e) {
        app.cancelCity(e);
    },
    bindCityChange: function (e) {
        app.bindCityChange(e);
    },
    submitCity: function (e) {
        app.submitCity(e);
    },
    openTakeoutLocation: function (e) {
        app.openTakeoutLocation(e);
    },
    callTakeout: function (e) {
        app.callTakeout(e);
    },
    getMoreAssess: function (e) {
        app.getMoreAssess(e);
    },
    changeEvaluate: function (e) {
        app.changeEvaluate(e)
    },
    deleteAllCarts: function (e) {
        app.deleteAllCarts(e);
    },
    clickCategory: function (e) {
        app.clickCategory(e);
    },
    goodsListMinus: function (e) {
        app.goodsListMinus(e);
    },
    goodsListPlus: function (e) {
        app.goodsListPlus(e);
    },
    cartListMinus: function (e) {
        app.cartListMinus(e);
    },
    cartListPlus: function (e) {
        app.cartListPlus(e);
    },
    changeAssessType: function (e) {
        app.changeAssessType(e);
    },
    showShoppingCartPop: function (e) {
        app.showShoppingCartPop(e);
    },
    hideShoppingCart: function (e) {
        app.hideShoppingCart(e);
    },
    showGoodsDetail: function (e) {
        app.showGoodsDetail(e);
    },
    hideDetailPop: function (e) {
        app.hideDetailPop(e);
    },
    hideModelPop: function (e) {
        app.hideModelPop(e);
    },
    chooseModel: function (e) {
        app.chooseModel(e);
    },
    sureChooseModel: function (e) {
        app.sureChooseModel(e);
    },
    clickChooseComplete: function (e) {
        app.clickChooseComplete(e);
    },
    reLocalAddress: function (e) {
        app.reLocalAddress(e);
    },
    tapGoodsTradeHandler: function (e) {
        app.tapGoodsTradeHandler(e);
    },
    tapVideoHandler: function (e) {
        app.tapVideoHandler(e);
    },
    tapVideoPlayHandler: function (e) {
        app.tapVideoPlayHandler(e);
    },
    tapVideoHandler: function (e) {
        app.tapVideoHandler(e);
    },
    tapInnerLinkHandler: function (e) {
        app.tapInnerLinkHandler(e);
    },
    tapPhoneCallHandler: function (e) {
        app.tapPhoneCallHandler(e);
    },
    tapRefreshListHandler: function (e) {
        app.tapRefreshListHandler(e);
    },
    tapGetCouponHandler: function (e) {
        app.tapGetCouponHandler(e);
    },
    tapCommunityHandler: function (e) {
        app.tapCommunityHandler(e);
    },
    tapPageShareHandler: function (e) {
        app.tapPageShareHandler(e);
    },
    turnToCommunityPage: function (e) {
        app.turnToCommunityPage(e);
    },
    tapToFranchiseeHandler: function (e) {
        app.tapToFranchiseeHandler(e);
    },
    tapToTransferPageHandler: function () {
        app.tapToTransferPageHandler();
    },
    tapToSeckillHandler: function (e) {
        app.tapToSeckillHandler(e);
    },
    tapToPromotionHandler: function () {
        app.tapToPromotionHandler();
    },
    tapToCouponReceiveListHandler: function () {
        app.tapToCouponReceiveListHandler();
    },
    tapToRechargeHandler: function () {
        app.tapToRechargeHandler();
    },
    tapToXcx: function (e) {
        app.tapToXcx(e);
    },
    tapFranchiseeLocation: function (e) {
        app.tapFranchiseeLocation(e);
    },
    showAddShoppingcart: function (e) {
        app.showAddShoppingcart(e);
    },
    hideAddShoppingcart: function () {
        app.hideAddShoppingcart();
    },
    selectGoodsSubModel: function (e) {
        app.selectGoodsSubModel(e);
    },
    resetSelectCountPrice: function () {
        app.resetSelectCountPrice();
    },
    // 电商
    clickGoodsMinusButton: function (e) {
        app.clickGoodsMinusButton();
    },
    clickGoodsPlusButton: function (e) {
        app.clickGoodsPlusButton();
    },
    sureAddToShoppingCart: function () {
        app.sureAddToShoppingCart();
    },
    sureAddToBuyNow: function () {
        app.sureAddToBuyNow();
    },
    clickTostoreMinusButton: function (e) {
        app.clickTostoreMinusButton(e);
    },
    clickTostorePlusButton: function (e) {
        app.clickTostorePlusButton(e);
    },
    readyToPay: function () {
        app.readyToTostorePay();
    },
    getValidateTostore: function () {
        app.getValidateTostore();
    },
    goToShoppingCart: function () {
        app.goToShoppingCart();
    },
    getCartList: function () {
        app.getTostoreCartList();
    },
    stopPropagation: function () {
    },
    turnToSearchPage: function (e) {
        app.turnToSearchPage(e);
    },
    previewImage: function (e) {
        var dataset = e.currentTarget.dataset;
        app.previewImage({
            current: dataset.src,
            urls: dataset.previewImgarr,
        });
    },
    scrollPageTop: function () {
        app.pageScrollTo(0);
    },
    suspensionTurnToPage: function (e) {
        app.suspensionTurnToPage(e);
    },
    tapToLuckyWheel: function (e) {
        app.tapToLuckyWheel(e);
    },
    tapToGoldenEggs: function (e) {
        app.tapToGoldenEggs(e);
    },
    tapToScratchCard: function (e) {
        app.tapToScratchCard(e);
    },
    tapToLuckyWheel: function (e) {
        app.tapToLuckyWheel(e);
    },
    keywordList: {},
    bindSearchTextChange: function (e) {
        // console.log(e.currentTarget);
        this.keywordList[e.currentTarget.dataset.compid] = e.detail.value;
    },
    // 文字组件跳到地图
    textToMap: function (e) {
        app.textToMap(e);
    },
    tapDynamicClassifyFunc: function (e) {
        app.tapDynamicClassifyFunc(e);
    },
    // 跳转到视频详情
    turnToVideoDetail: function (e) {
        app.turnToVideoDetail(e);
    },
    // 单个视频组件播放视频
    startPlayVideo: function (e) {
        app.startPlayVideo(e);
    },
    // 视频播放报错
    videoError: function (e) {
        app.showModal({
            content: e.detail.errMsg
        });
    },
    // 视频项目播放事件
    videoProjectPlay: function (e) {
        app.videoProjectPlay(e);
    },
    // 视频项目暂停事件
    videoProjectPause: function (e) {
        app.videoProjectPause(e);
    },
    // 跳转到资讯详情
    turnToNewsDetail: function (e) {
        app.turnToNewsDetail(e)
    },
    //切换资讯分类
    getNewsCateList: function (e) {
        app.getNewsCateList(e);
    },
});
// if(flag = 2){
//     // console.log("ok");
//     Page(pageData);
// }

